package simulations;

import java.awt.*;


/**
 * POJO used to represent the size of the walled area in which the assemblies
 * animate.
 * 
 * @author Zach Michaelov
 */
public class BoundingArea {
    /**
     * Constant that determines how many pixels the
     * BoundingArea can shrink or grow.
     */
    private static final int STEP = 10;
    /**
     * represents the bounds of our BoundingArea.
     */
    private Dimension myBounds;

    /**
     * Constructs a BoundingArea based on the given size.
     * 
     * @param size the size of our BoundingArea
     */
    public BoundingArea (Dimension size) {
        myBounds = new Dimension(size);
    }

    /**
     * gets the myBounds of our BoundingArea.
     * 
     * @return the myBounds of our BoundingArea
     */
    public Dimension getMyBounds () {
        return myBounds;
    }

    /**
     * shrink the BoundingArea by a constant.
     */
    protected void shrink () {
        double height = myBounds.getHeight() - STEP;
        double width = myBounds.getWidth() - STEP;
        myBounds.setSize(width, height);
    }

    /**
     * grow the BoundingArea by a constant.
     */
    protected void grow () {
        double height = myBounds.getHeight() + STEP;
        double width = myBounds.getWidth() + STEP;
        myBounds.setSize(width, height);
    }

    /**
     * Draws our BoundingArea with the given graphics object.
     * 
     * @param pen
     */
    protected void paint (final Graphics2D pen) {
        pen.setColor(Color.BLACK);
        pen.drawRect(0, 0, (int) myBounds.getWidth(),
                (int) myBounds.getHeight());
    }

}
